% ************************************************************************ 
%     Module name   : Lynx Simulation - Aquisition Mode Run                                                     
%                                                                          
%     Description   : This will run the Aquisition mode on a specific target.                                                    
%                                                                          
%     $Header: /Lynx/SimulationFramework/RSP/IFS/IFSRun.m 2     15/10/08 16:08 Lwabeke $ 
%                                                                          
%    $Author: Lwabeke $	            
%                                                                         
%    $Revision: 2 $                
%                                                                         
% ************************************************************************
%     $History: IFSRun.m $ 
% 
%
% ************************************************************************
function     display_performance(perfHist, visualiseState, param)

% figure(3)
% plot(perfHist.time, perfHist.missedTargets,'.-r');
% hold on;
% plot(perfHist.time, perfHist.extraTargets,'.-');
% hold off

delta_time = diff([0 perfHist.time]);

figure(4);
plot(diff(visualiseState.time),'.-')
title('Time for each scan')

meanScanTime = mean(diff(visualiseState.time))

meanTargetsVisited = mean(visualiseState.targetVisit)

% missedTargets = delta_time * perfHist.missedTargets'
% 
% extraTargets = delta_time * perfHist.extraTargets'
% 
% figure(4)
% subplot(4,1,1)
% imagesc(perfHist.time, 1:param.learn.search.num_actions, perfHist.search.chosen_action);
% title('Reward per action over time')
% subplot(4,1,2)
% imagesc(perfHist.time, 1:param.learn.search.num_states,perfHist.search.usedState);
% title('Used state over time')
% subplot(4,1,3)
% imagesc(perfHist.time, 1:param.learn.search.num_states,perfHist.search.policy);
% title('Search policy over time')
% subplot(4,1,4)
% imagesc(perfHist.time, 1:param.learn.search.num_states,perfHist.search.V);
% title('Search setup value over time')
% 
% 
% figure(5);
% X=-5:5;
% 
% subplot(5,1,1)
% hist(perfHist.search.hist.radVel(:,1), X )
% title('Radial Velocity of possible search targets')
% 
% subplot(5,1,2)
% plot(X, max(min(polyval(param.radarModes.searchMode.NCI.pd, abs(X)), 1), 0))
% title('Detection probability of mode 1 (NCI)')
% axis([-5 5 0 1])
% subplot(5,1,3)
% plot(X, max(min(polyval(param.radarModes.searchMode.MTI.pd, abs(X)), 1), 0))
% title('Detection probability of mode 2 (MTI)')
% axis([-5 5 0 1])
% subplot(5,1,4)
% plot(X, max(min(polyval(param.radarModes.searchMode.Stationary.pd, abs(X)), 1), 0))
% title('Detection probability of mode 3 (Stationary)')
% axis([-5 5 0 1])
% 
% subplot(5,1,5)
% 
% hist(visualiseState.chosen_action,3)
% 
% meanPdNCI = mean(max(min(polyval(param.radarModes.searchMode.NCI.pd, abs(perfHist.search.hist.radVel(:,1))), 1), 0))
% meanPdMTI = mean(max(min(polyval(param.radarModes.searchMode.MTI.pd, abs(perfHist.search.hist.radVel(:,1))), 1), 0))
% meanPdStationary = mean(max(min(polyval(param.radarModes.searchMode.Stationary.pd, abs(perfHist.search.hist.radVel(:,1))), 1), 0))
% 
% %%
% figure(6);
% X=-8:8;
% 
% for cntr=1:param.radarModes.searchMode.numSearchSectors
% subplot(param.radarModes.searchMode.numSearchSectors,1,cntr)
% hist(perfHist.search.hist.radVel(perfHist.search.hist.radVel(:,2)==cntr), X )
% end
% %title('Radial Velocity of possible search targets')
